package br.com.nuccitec.jfera.basic;

import br.com.nuccitec.jfera.api.IRemoteResponse;
import br.com.nuccitec.jfera.business.AbstractBusinessExecutor;
import br.com.nuccitec.jfera.business.BusinessResponse;
import br.com.nuccitec.jfera.business.IBusinessPrefixExecutor;
import br.com.nuccitec.jfera.validation.vo.AbstractVO;

public class GenericFindAllFromUserExecutor extends AbstractBusinessExecutor implements IBusinessPrefixExecutor {
	private static final String FIND_ALL_PREFIX = "FIND_ALL_FROM_USER";

	@Override
	public String requestPrefixToAttend() {
		return FIND_ALL_PREFIX;
	}

	@Override
	public IRemoteResponse execute(Object objVO) {
		getColaborator().logInfo(getClass(), "Executing " + FIND_ALL_PREFIX + " for " + objVO);
		AbstractVO vo = (AbstractVO) objVO;
		vo.setColaborator(getColaborator());
		return new BusinessResponse(vo.findAllFromUser());
	}
}
